<template>
  <div class="app-container">

    <!--    按钮区域-->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="showDown"
        >导入节假日文件</el-button>

        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="showDown"
        >下载模板</el-button>
      </el-col>
    </el-row>


    <el-table
      v-loading="loading"
      :data="dateList"
      @selection-change="handleSelectionChange"
    >
      <el-table-column label="序号" prop="id" width="120" />

      <el-table-column
        label="年份"
        prop="year"
        :show-overflow-tooltip="true"
        width="150"
      />
      <el-table-column
        label="月"
        prop="month"
        :show-overflow-tooltip="true"
        width="150"
      />
      <el-table-column label="日" prop="day" width="100" />
      <el-table-column label="是否节假日" align="center" width="100">
        <template slot-scope="scope">
          <el-switch
            v-model="scope.row.holiday"
            :active-value= 'true'
            :inactive-value= 'false'
            @change="handleStatusChange(scope.row)"
          ></el-switch>
        </template>
      </el-table-column>

      <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope" v-if="scope.row.roleId !== 1">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:role:edit']"
          >修改</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:role:remove']"
          >删除</el-button
          >

        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />


<!--    上传节假日模板-->



  </div>

</template>


<script>

import { getHolidayList, getHolidayTemplate } from "@/api/manage/apiHoliday";



export  default  {
  name:"holiday",

  created() {
    this.getList()
  },
  data(){

    return{
      loading:true,
      dateList:[],
      total:0,
      year:0,
      month:0,
      queryParams:{
        query: '',
        pageNum: 1,
        pageSize: 10
      },
      addDialogVisible:false,
      addForm:{},
      rules: {
        roleName: [
          { required: true, message: "角色名称不能为空", trigger: "blur" }
        ],

      },

    }
  },
  methods:{
    addType(){

    },
    handleSelectionChange(value){

    },

    showDown(){
      var url2 = "/system/holiday/download";
      window.open(url2)


    },
    getList(){
      getHolidayList(this.queryParams).then(respone =>{

        console.log(respone);

        this.dateList = respone.rows;
        this.total = respone.total;
        this.loading = false;
      })
    }
  }
}


</script>
<style>

</style>
